package com.example.sentinel.sentinel;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.BlockExceptionHandler;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeException;
import com.example.sentinel.exception.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * 服务降级的方法
 */
@Slf4j
public class MyDegraded {

    /**
     * 降级方法
     * @param exception
     * @return
     */
    public static R degradedRuleWay(BlockException exception){
        log.error("进入到降级方法啦");
        return R.error(-104, "降级异常");
    }
}
